
var defaultParameter = {
  pageNumber: 1,
  pageSize: 10
};


function initTable(){
 var columns=[[
    {field:'impleProjId',title:'项目id',fitColumns:true,hidden:true,
    },
    {field:'impleProjName',title:'实施项目名称',fitColumns:true,
    },
    {field:'purchPlanId',title:"采购计划id",fitColumns:true,hidden:true,
     },
    {field:'purchPlanName',title:"采购计划名称",fitColumns:true,
    },
    {field:'tenderInfoId',title:"标书id",fitColumns:true,hidden:true,
     },
    {field:'tenderCode',title:"标书编码",fitColumns:true,hidden:true,
    },
    {field:'tenderTitle',title:"标书名称",fitColumns:true,
     },
    {field:'startDt',title:'开标时间',width:$(this).width()*0.1,fitColumns:true,

    },
    {field:'person',title:"参与人员",width:$(this).width()*0.1,fitColumns:true,
     },

    {field:'statusCd',title:"状态",width:$(this).width()*0.1,fitColumns:true,
    },
   {field:'description',title:"备注",width:$(this).width()*0.1,fitColumns:true,
   },
    {field:'operation',title:"操作",width:$(this).width()*0.1,
      formatter: function(value,row,index){
        return '<a class="edit" href="javascript:void(0)" title="编辑" onclick="updatePurchasePlan('
            + index
            + ')"> <i class="fa fa-edit"></i></a>'
            +
            '<a class="remove" href="javascript:void(0)" title="删除" onclick="delPurchasePlanConfirm('
            + index
            + ')"><i class="fa fa-trash"></i></a>';
    }},
  ]];

  $('#tenderList').datagrid({
//    url:'/InfoManageWeb/purchaseService/queryPurchasePlanListByCondition',
//    method:'post',
    dataType : 'json',
    queryParams:defaultParameter,
    pagination:true,
    fit: true,
    columns:columns,
    onBeforeLoad : function(param){
    console.log(param);
    for (var key in param) {
    if(key=="rows"){
    delete param[key];
    }
    }
    },
  });
  var p = $('#tenderList').datagrid('getPager');
  $(p).pagination({
    pageSize: 10,//每页显示的记录条数，默认为10
    pageList: [10,20],//可以设置每页记录条数的列表
    beforePageText: '第',//页数文本框前显示的汉字
    afterPageText: '页    共 {pages}  页',
    displayMsg: '当前显示 {from} - {to} 条记录 共 {total}  条记录',
    onSelectPage:function(pageNumber, pageSize){
      defaultParameter.pageNumber=pageNumber;
      defaultParameter.pageSize=pageSize;
      var planName=$("#planName").val().trim();
      var belongPlan=$("#belongPlan").val().trim();
      defaultParameter.planName=planName;
      defaultParameter.belongPlan=belongPlan;
      $('#tenderList').datagrid('reload',defaultParameter);
    }
  });
}







function reset(){
 $('#tenderModal').modal("show");
}

$(function(){
	//	所属规划
	$("#belongPlan").constantCommpent({
	    elmIdSel : "belongPlan",//需要展示的位置下拉框
	    constParamCode : "PLAN_PROJ_CLASS",//需要加载的常量编码
	    callbackFunc: function (objvalue, objname) {//下拉框值改变时回调
	    }
	});
    initTable();

$("#invitManageForm").bootstrapValidator({
      feedbackIcons: {
        valid: 'glyphicon glyphicon-ok',
        invalid: 'glyphicon glyphicon-remove',
        validating: 'glyphicon glyphicon-loadData'
      },
      excluded: [':disabled', ':hidden', ':not(:visible)'],
      fields: {
        projectName: {
          validators: {
            notEmpty: {
              message: '请选择项目'
            }
          }
        },
        purchPlanName: {
          validators: {
            notEmpty: {
              message: '请选择采购计划'
            }
          }
        },
        tenderTitle: {
          validators: {
            notEmpty: {
              message: '标书名称不能为空'
            }
          }
        },
        tenderCode: {
          validators: {
            notEmpty: {
              message: '标书编码不能为空'
            }
          }
        },
        internalRevierDt: {
          validators: {
            notEmpty: {
              message: '内部评审时间不能为空'
            }
          }
        },
        internalParty: {
          validators: {
            notEmpty: {
              message: '内部评审参与人不能为空'
            }
          }
        },
        internalAddr: {
          validators: {
            notEmpty: {
              message: '内部评审地点不能为空'
            }
          }
        },
        expertRevierDt: {
          validators: {
            notEmpty: {
              message: '专家评审时间不能为空'
            }
          }
        },
        expertParty: {
          validators: {
            notEmpty: {
              message: '专家评审参与人不能为空'
            }
          }
        },
        expertAddr: {
          validators: {
            notEmpty: {
              message: '专家评审地点不能为空'
            }
          }
        },
        leadingPerson: {
          validators: {
            notEmpty: {
              message: '内部评审责任人不能为空'
            }
          }
        },
        statusCd: {
          validators: {
            notEmpty: {
              message: '请选择状态'
            }
          }
        },
      }
    });


})